<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="rctx" value="${pageContext.request.contextPath}" />
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
<%
	String rloginName = request.getParameter("loginName");
	String rpassword = request.getParameter("password");
	String rcenterUrl = request.getParameter("centerUrl");
%>
</head>
<body>
</body>
<script src="jquery-2.1.4.min.js"></script>
<script src="jquery.cookie.js"></script>
<script type="text/javascript">
var loginName = '<%=rloginName%>';
var password = '<%=rpassword%>';
var centerUrl = '<%=rcenterUrl%>';
$(document).ready(function(){ 
	$.ajax({
        type: "GET",
        url: centerUrl + "/sysUser/cloudrelogin",
        data: {
            loginName: loginName,
            password: password,
        },
        dataType: "json",
        success: function (data) {
        	data=data[0];
            if (data.result == 'SUCCESS') {
                //将用户信息保存在cookie中
                $.cookie('userId', data.id, {path: '/'}); //用户Id
                $.cookie('loginName', data.code, {path: '/'}); //用户名称
                $.cookie('trueName', data.fullName, {path: '/'}); //用户名称
                $.cookie('orgId', data.orgId, {path: '/'}); //部门编号
                $.cookie('loginPwd', data.loginPwd, {path: '/'}); //用户密码
                $.cookie('ip', data.ip, {path: '/'});//用户本机ip
				$.cookie('checkState', data.checkState, {path: '/'});//是否过滤权限1，否0，是
                $.cookie('loginTime', new Date().getTime(), {path: '/'});
                $.cookie('language', 'zh-CN', { path: '/'});//默认中文
                window.location.href = "${rctx}/pages/main.jsp"; //主页面
            } else {
				console.log('登录提示',data.result);
            }
        }
    });
}); 
</script>
</html>